import { BaseEntity } from '../../base/entity/base';
import { Column, Entity } from 'typeorm';

/**
 * 自动化流水线
 */
@Entity('automation_pipeline')
export class AutomationPipelineEntity extends BaseEntity {
  @Column({ comment: '任务名称' })
  name: string;

  @Column({ comment: '是否启用', dict: ['禁用', '启用'], default: 1 })
  status: number;

  @Column({ comment: '触发方式', dict: ['立即', '延时'], default: 0 })
  triggerType: number;

  @Column({
    comment: '条件关系',
    dict: ['满足全部条件', '满足任一条件'],
    default: 0,
  })
  conditionRelation: number;

  @Column({ comment: '生效开始时间', nullable: true })
  effectStartTime: string;

  @Column({ comment: '生效结束时间', nullable: true })
  effectEndTime: string;

  @Column({
    comment: '生效日期类型',
    dict: ['每天', '工作日', '周末', '自定义'],
    default: 0,
  })
  effectDateType: number;

  @Column({ comment: '自定义生效日期(JSON格式)', nullable: true })
  effectDates: string;

  @Column({ comment: '延时执行时间(秒)', default: 0 })
  delayTime: number;

  @Column({ comment: '备注', nullable: true })
  remark: string;
}
